package com.yequan.designpattern.proxy.dynamic_proxy.jdk.first_generation;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

public class GamePlayInvocationHandler implements InvocationHandler {

    //被代理者
    Class cls = null;
    //被代理实例
    Object object = null;

    public GamePlayInvocationHandler(Object object) {
        this.object = object;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println(method.getName() + "  执行前...");
        Object result = method.invoke(this.object, args);
        System.out.println(method.getName() + "  执行后...");
        return result;
    }
}
